package com.aaa.common.result;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;


/**
 * Created with IntelliJ IDEA.
 *
 * @Auther: 宋文森
 * @Date: 2021/01/25/17:18
 * @Description:
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result implements Serializable {

    /**
     * code 状态码 1代表执行成功  0代表执行失败
     * message 返回信息
     * data 返回信息
     */
    private Integer code;
    private String  message;
    private Object  data;


    public static Result success(Object data){
        return new Result(1,"return value ok",data);
    }

    public static Result success(String message){
        return new Result(1,message,null);
    }

    public static Result error(String message){
        return new Result(0,"error",null);
    }



}
